<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
  <script src="jquery-1.11.3.min.js"></script>
 </head>
 <body>
     用户名:<input type="text" id="userName">
    <button id="btn1">确定（原生版）</button>
    <button id="btn2">确定（jQuery版）</button>	
	<div id="div2"><div>
 </body>
 <script>
    //原生js
	var btn1 = document.getElementById("btn1");
	var input = document.getElementById("userName");
	var div = document.createElement("div");
	btn1.onclick = function(){
	   div.innerText = input.value;
	   btn1.parentNode.appendChild(div);
	     
	}

	//使用jQuery
    $('#btn2').click(function(){
	    var text = $('#userName').val();
		$('#div2').text(text);
	});
 </script>
</html>
